//
//
// File generated from our OpenAPI spec
//
//

package stripe

import "time"

// Event reason type.
type V2CoreEventReasonType string

// List of values that V2CoreEventReasonType can take
const (
	V2CoreEventReasonTypeRequest V2CoreEventReasonType = "request"
)

// Information on the API request that instigated the event.
type V2CoreEventReasonRequest struct {
	// ID of the API request that caused the event.
	ID string `json:"id"`
	// The idempotency key transmitted during the request.
	IdempotencyKey string `json:"idempotency_key"`
}

// Reason for the event.
type V2CoreEventReason struct {
	// Information on the API request that instigated the event.
	Request *V2CoreEventReasonRequest `json:"request,omitempty"`
	// Event reason type.
	Type V2CoreEventReasonType `json:"type"`
}

// Events are generated to keep you informed of activity in your business account. APIs in the /v2 namespace generate [thin events](https://docs.stripe.com/event-destinations#benefits-of-thin-events) which have small, unversioned payloads that include a reference to the ID of the object that has changed. The Events v2 API returns these new thin events. [Retrieve the event object](https://docs.stripe.com/event-destinations#fetch-data) for additional data about the event. Use the related object ID in the event payload to [fetch the API resource](https://docs.stripe.com/event-destinations#retrieve-the-object-associated-with-thin-events) of the object associated with the event. Comparatively, events generated by most API v1 include a versioned snapshot of an API object in their payload.
type V2BaseEvent struct {
	APIResource
	// Authentication context needed to fetch the event or related object.
	Context string `json:"context,omitempty"`
	// Time at which the object was created.
	Created time.Time `json:"created"`
	// Unique identifier for the event.
	ID string `json:"id"`
	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
	Livemode bool `json:"livemode"`
	// String representing the object's type. Objects of the same type share the same value of the object field.
	Object string `json:"object"`
	// Reason for the event.
	Reason *V2CoreEventReason `json:"reason,omitempty"`
	// The type of the event.
	Type string `json:"type"`
}

func (e *V2BaseEvent) getBaseEvent() *V2BaseEvent {
	return e
}
